package cn.vcjf.weapp.api.payment.qfwxpay.model;

/**
 * @Auther: zhengzihang
 * @Date: 2018/9/28 11:56
 * @Description:
 */
public class VcQfPayRes {
	private String code;
	private String msg;
	private String errMsg;
	private String payUrl;
	private String txAmt;
	private String outTraOrderNo;
	private String orderSn;
	/**
	 * 唤起微信支付的参数，详见以下示例中pay_params
	 */
	private String resParam;
	/**
	 * 钱方返回所有结果
	 */
	private String result;

	/**
	 * 请求下单结果返回码,0000表示下单成功；
	 * @return
	 */
	public boolean isOK(){
		return "0000".equalsIgnoreCase(code);
	}
	/**
	 * 1143、1145表示交易中，需要继续查询交易结果； 其他返回码表示失败
	 */
	public boolean isWait(){
		return "1143".equalsIgnoreCase(code)||"1145".equalsIgnoreCase(code);
	}

	public static VcQfPayRes failedPayResp(String msg) {
		VcQfPayRes vcQfPayRes = new VcQfPayRes();
		vcQfPayRes.setCode("10001");
		vcQfPayRes.setMsg(msg);
		vcQfPayRes.setErrMsg(msg);
		return vcQfPayRes;
	}

	public static VcQfPayRes successPayRes(String msg) {
		VcQfPayRes vcQfPayRes = new VcQfPayRes();
		vcQfPayRes.setCode("10000");
		vcQfPayRes.setMsg(msg);
		return vcQfPayRes;
	}


	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public void setErrMsg(String errMsg) {
		this.errMsg = errMsg;
	}

	public String getErrMsg() {
		return errMsg;
	}

	public void setPayUrl(String payUrl) {
		this.payUrl = payUrl;
	}

	public String getPayUrl() {
		return payUrl;
	}

	public void setTxAmt(String txAmt) {
		this.txAmt = txAmt;
	}

	public String getTxAmt() {
		return txAmt;
	}

	public void setOutTraOrderNo(String outTraOrderNo) {
		this.outTraOrderNo = outTraOrderNo;
	}

	public String getOutTraOrderNo() {
		return outTraOrderNo;
	}

	public void setOrderSn(String orderSn) {
		this.orderSn = orderSn;
	}

	public String getOrderSn() {
		return orderSn;
	}

	public void setResParam(String resParam) {
		this.resParam = resParam;
	}

	public String getResParam() {
		return resParam;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public String getResult() {
		return result;
	}

	public static void main(String[] args) {
		String resStr = "{\"package\": \"prepay_id=wx20180115104545871fa226d10608087535\", \"timeStamp\": \"1515984345463\", \"signType\": \"MD5\", \"paySign\": \"E75ED8747CFB0F00DEDBD97FB8D92E9E\", \"appId\": \"wx290ce4878c94369d\", \"nonceStr\": \"1515984345463\"}"
				.replace("}", "").replace("{", "").replace("\"", "").replace(":", "=").replace(",", "&").replace(" ", "");
		System.out.printf(resStr);
	}
}
